<div class="tab-box">
    <ul>
        <li ng-class="{active:search.state==1}"  ui-sref="application.contract({state:1})" ui-sref-opts="{reload:true}">待签合同</li>
        <li ng-class="{active:search.state==2}" ui-sref="application.contract({state:2})" ui-sref-opts="{reload:true}">历史合同</li>
        <li ng-class="{active:search.state==3}" ui-sref="application.contract({state:3})" ui-sref-opts="{reload:true}">合同编号</li>
    </ul>
</div>

<div class="section-search">
  <span class="line-block" ng-if="state==1 || state==2" ng-init="params.loan_type=-1">
      <ui-select ng-model="params.loan_type" >
          <ui-option value="-1">贷款方式</ui-option>
          <ui-option value="1">车贷</ui-option>
          <ui-option value="2">房贷</ui-option>
          <ui-option value="3">信贷</ui-option>
      </ui-select>
  </span>
  <span class="line-block filed" ng-if="state==1 || state==2" ng-init="params.type=-1">
      <ui-select ng-model="params.type" error-tis="err.type" >
            <ui-option value="-1">选择字段</ui-option>
            <ui-option value="1">借款编号</ui-option>
            <ui-option value="2">客户姓名</ui-option>
            <ui-option value="3">身份证</ui-option>
            <ui-option value="4">电话号码</ui-option>
            <ui-option value="5">业务员</ui-option>
      </ui-select>
  </span>
  <span class="line-block" ng-if="state==3" ng-init="params.status=-1">
      <ui-select ng-model="params.status">
          <ui-option value="-1">编号状态</ui-option>
          <ui-option value="1">正常</ui-option>
          <ui-option value="2">已作废</ui-option>

      </ui-select>
  </span>
  <span class="line-block filed" ng-if="state==3" ng-init="params.type=-1">
      <ui-select ng-model="params.type">
          <ui-option value="-1">选择字段</ui-option>
          <ui-option value="1">订单编号</ui-option>
          <ui-option value="2">合同编号</ui-option>
      </ui-select>
  </span>
  <span class="line-block" style="width: 220px;">
      <input type="text" class="form-control" placeholder="请先选择左侧要搜索的字段" ng-model="params.keyword" />
  </span>
  <span class="line-block">
      <button class="btn btn-success search-btn" ng-click="searchHandle()"><em class="glyphicon glyphicon-search"></em></button>
  </span>
</div>
<!-- 历史合同/待签合同 -列表 -->
<div class="dataList" ng-if="state==1 || state==2">
  <table class="table">
      <thead>
      <tr>
          <th width="70">
            <label><input ng-disabled="dataList.length<1" class="ver-top" type="checkbox" ng-click="$_fn.ch_id_all($event,'ch_id')">全选</label>
          </th>
          <th width="120">操作</th>
          <th>订单编号</th>
          <th>贷款产品</th>
          <th>借款人</th>
          <th>贷款金额</th>
          <th>贷款期限</th>
          <th>填单人员</th>
          <th>合同编号</th>
          <th>创单时间</th>
          
      </tr>
      </thead>
      <tbody>
        <tr ng-if="dataList.length<1" class="_loading">
          <td colspan="16">
              <div class="no_data">暂时找不到数据</div>
          </td>
        </tr>
        <tr ng-repeat="(i,item) in dataList track by $index" ng-click="$_fn.tabClick($event)">
          <td>
              <input type="checkbox" name="ch_id" value="{{item.id}}">
          </td>
          <td>
            <dropdown placeholder="请选择" ng-click="$event.stopPropagation();">
              <li ng-repeat="(i,items) in subMenu track by $index" ng-if="items.state==0 || state==items.state" 
              	ng-click="operation(items.path, {loan_number:item.loan_number,at_name:item.at_name,interest:item.interest,oid:item.id,pid:item.pid,s_id:item.s_id,apply_money:item.apply_money,Table:'t_order'})">
              	{{items.name}}</li>
            </dropdown>
          </td>
          <td>{{item.loan_number}}</td>
          <td>{{item.loan_type==1?'车贷':item.loan_type==2?'房贷':item.loan_type==3?'信贷':''}}</td>
          <td>{{item.personal_name+'  '+item.minor_name}}</td>
          <td>{{item.apply_money | toRMB}}</td>
          <td>{{item.at_name}}</td>
          <td>{{item.admin_name}}</td>
          <td><span ng-class="{'pact-back':item.contract_no}">{{item.contract_no || '--'}}</span></td>
          <td>{{item.found_time}}</td>
        </tr>
      </tbody>
  </table>
</div>
<!-- 合同编号列表 -->
<div class="dataList" ng-if="state==3">
  <table class="table">
      <thead>
      <tr>
          <th width="70"><label><input ng-disabled="dataList.length<1" class="ver-top" type="checkbox" ng-click="$_fn.ch_id_all($event,'ch_id')">全选</label></th>
          <th width="120">操作</th>
          <th>合同编号</th>
          <th>关联订单编号</th>
          <th>状态</th>
          <th>创建时间</th>
          
      </tr>
      </thead>
      <tbody>
        <tr ng-if="dataList.length<1" class="_loading">
          <td colspan="16">
              <div class="no_data">暂时找不到数据</div>
          </td>
        </tr>
        <tr ng-repeat="(i,item) in dataList track by $index" ng-click="$_fn.tabClick($event)">
          <td>
              <input type="checkbox" name="ch_id" value="{{item.id}}">
          </td>
          <td>
            <dropdown placeholder="请选择" ng-click="$event.stopPropagation();">
              <li ng-repeat="(i,items) in subMenu track by $index" ng-if="items.state==0 || state==items.state" ng-click="operation(items.path, {loan_number:item.loan_number,at_name:item.at_name,interest:item.interest,oid:item.id,pid:item.pid,apply_money:item.apply_money,Table:'t_order'})">{{items.name}}</li>
            </dropdown>
          </td>
          <td><span ng-class="{'pact-back':item.contract_no}">{{item.contract_no || '--'}}</span></td>
          <td>{{item.loan_number}}</td>
          <td>{{item.status==1?'正常': '已作废'}}</td>
          <td>{{item.add_time}}</td>
        </tr>
      </tbody>
  </table>
</div>
<div class="page" ng-if="dataList.length>0">
  <div class="operation">
      <label><input type="checkbox" ng-click="$_fn.ch_id_all($event,'ch_id')">全选</label>
      <!-- <dropdown placeholder="批量操作">
          <li>批量作废</li>
      </dropdown> -->
      <dropdown placeholder="批量操作" ng-click="$event.stopPropagation();">
          <li ng-repeat="(i,items) in subMenu track by $index" ng-if="items.state==-1" ng-click="operation(items.path, {batchOper:'true'})">{{items.name}}</li>
      </dropdown>
  </div>
  <pages total="{{page.total}}" current="page.current" page-size="{{page.pageSize}}"></pages>
</div>